import React, {Component} from 'react';
import NavStyles from './index.module.scss';
import {PropsInterface} from './types';
import Link from '../Link';
class Nav extends Component<PropsInterface> {
    static defaultProps = {
        type: 'head',
    };

    componentWillMount() {}
    render() {
        const {navList} = this.props;
        return (
            <div className={`${NavStyles.nav} clearfix`} style={this.props.type === 'foot' ? {padding: '10px 0'} : {}}>
                <div className={`${NavStyles.l} ${this.props.type}`}>
                    <ul>
                        {navList.map(item => (
                            <Link key={item.path} path={item.path}>
                                <li>{item.meta && item.meta.name}</li>
                            </Link>
                        ))}
                    </ul>
                </div>
                <div className={`${NavStyles.r}`}>{this.props.children}</div>
            </div>
        );
    }
}

export default Nav;
